package action;

import java.util.List;

import model.DataModel;
import model.FusionCharts;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import service.RptProdTypeService;
import action.base.BaseAction;

@Controller
@Scope("prototype")
public class RptProdTypeAction extends BaseAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Autowired
	private RptProdTypeService rptProdTypeService;
	private FusionCharts charts;
	private List<DataModel> data;
	private boolean success = false;

	public String type4rpt() {
		charts = new FusionCharts();
		charts.setCaption("");
		charts.setxAxisName("产品分类");
		charts.setyAxisName("报告单数量");
		charts.setNumberPrefix("");
		charts.setShowLegend("1");
		charts.setLegendPosition("RIGHT");
		Integer area = super.getParameterInt("areaid");
		if (area != null) {// 上海市做特殊处理
			if (area == 33) {
				area = null;
			}
		}
		data = rptProdTypeService.type4Rpt(area);
		success = true;
		return "success";
	}

	public FusionCharts getCharts() {
		return charts;
	}

	public void setCharts(FusionCharts charts) {
		this.charts = charts;
	}

	public List<DataModel> getData() {
		return data;
	}

	public void setData(List<DataModel> data) {
		this.data = data;
	}

	public boolean isSuccess() {
		return success;
	}

	public void setSuccess(boolean success) {
		this.success = success;
	}

}
